var Ball = function(game) {
   // var image = imageFromPath('ball.png')
    var o = game.imageByName('ball')
    
    o.image=image,
    o.x=100,
    o.y=250,
    o.speedX=5,
    o.speedY=5,
    o.fired=false,
    
    o.fire = function () {
        o.fired = true
    }

   o.move = function () {
       //log('ball move')
        if(o.fired)
        {                    
            if(o.x < 0 || o.x > 400){
                o.speedX *=-1
            }
            if(o.y < 0 || o.y > 300){
                o.speedY *=-1
            }
            //move
            o.x += o.speedX
            o.y += o.speedY
        }
   }

   o.reverse = function () {
       o.speedY *= -1 
   }

    return o
}